<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:t="http://myfaces.apache.org/tomahawk">

<f:view>
	<f:loadBundle var="messages" basename="messages" />

	<head>
	<title>#{messages['topicoList.title']}</title>
	<style type="text/css">
@import
	url(#{facesContext.externalContext.requestContextPath}/styles/myfaces.css)
	;
</style>
	</head>

	<h:form id="criarTopico">
		<h:commandButton value="Criar Topico" action="add" id="add"
			immediate="true" styleClass="button" />
</h:form>
		<!-- Error from this table is caused by http://issues.apache.org/jira/browse/TOMAHAWK-466 -->
		<t:dataTable id="topicos" var="topico" style="margin-top: 10px"
			value="#{topicoList.topicos}" rows="25"
			sortColumn="#{topicoList.sortColumn}"
			sortAscending="#{topicoList.ascending}"
			styleClass="scrollerTable table" headerClass="standardTable_Header"
			rowClasses="standardTable_Row1,standardTable_Row2"
			columnClasses="standardTable_Column,standardTable_Column,standardTable_Column,standardTable_Column,standardTable_ColumnCentered">


			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="id" arrow="true">
						<h:outputText value="#{messages['topico.id']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:form id="editTopico" >
				<h:commandLink action="#{topicoForm.edit}" value="#{topico.id}">
					<f:param name="id" value="#{topico.id}" />
				</h:commandLink>
				</h:form>
			</t:column>


			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="titulo" arrow="true">
						<h:outputText value="#{messages['topico.titulo']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{topico.titulo}" />
			</t:column>


			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="descricao" arrow="true">
						<h:outputText value="#{messages['topico.descricao']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{topico.descricao}" />
			</t:column>


			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="datapostagem" arrow="true">
						<h:outputText value="#{messages['topico.datapostagem']}" />
					</t:commandSortHeader>
				</f:facet>
				<h:outputText value="#{topico.dataPostagem}" />
			</t:column>
			
			
			<t:column>
				<f:facet name="header">
					<t:commandSortHeader columnName="subTopicos" arrow="true">
						<h:outputText value="Responder" />
					</t:commandSortHeader>
				</f:facet>
				<h:form id="responderTopico">
				<h:commandLink action="#{topicoForm.responder}"
				   value="Responder" styleClass="button">
          <f:param name="id" value="#{topico.id}" />
        </h:commandLink>
				</h:form>
			</t:column>
			 

		</t:dataTable>
		<ui:include src="/tableFooter.xhtml">
			<ui:param name="tableName" value="topicos" />
		</ui:include>

		<script type="text/javascript">
	highlightTableRows("editTopico:topicos");
</script>
	

</f:view>
</html>